# -*-coding:utf-8-*-
"""
@project: python-project
@Time: 2024-07-12 18:44
@Author: Loneliness_Burial
@File: numpy求平均值求和.py
@Motto: 深情不改必坠死海
@software: pycharm
@version: python 3.7
"""

import numpy as np

arr = np.random.randint(1, 10, (3, 4))  # 取1~10之间的三行四列的随机整数数组
print(arr)
# 平均值
v1 = arr.mean()  # 默认为空
print(v1)
v2 = arr.mean(axis=1)  # axis为轴 axis=1沿着横向，axis=0沿着纵向
print(v2)

# 求和
v3 = arr.sum()
print(v3)
v4 = arr.sum(axis=0)
print(v4)
